package wifiunion.com.notice.widget.selectmemberdialog.model;


import com.google.gson.reflect.TypeToken;

import java.util.HashMap;
import java.util.List;

import wifiunion.com.notice.BaseCallBack;
import wifiunion.com.notice.Constants;
import wifiunion.com.notice.HttpUtils;
import wifiunion.com.notice.entity.SubNoticeTargetEntity;
import wifiunion.com.notice.widget.selectmemberdialog.entity.SelectMember;

/**
 * Created by Administrator on 2018/7/9.
 */

public class SelectModel {


    public void getRelGroupList(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEUSER_RELGROUPLIST;
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLUSER_RELGROUPLIST;
        } else if (mType == 2) {
            url = Constants.HTTP_URL_GET_EXPOSUREUSER_RELGROUPLIST;
        } else if (mType == 3) {
            url = Constants.HTTP_URL_GET_NOTICTARGETRELGROUPLIST;
        }

        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<SelectMember>>() {
                }.getType());
    }


    public void getRelGoupMemberList(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEUSER_RELGROUPUUIDLIST;
            HttpUtils.HttpGetRequest_Asyn(url, params,
                    callBack, new TypeToken<List<SelectMember>>() {
                    }.getType());
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLUSER_RELGROUPUUIDLIST;
            HttpUtils.HttpGetRequest_Asyn(url, params,
                    callBack, new TypeToken<List<SelectMember>>() {
                    }.getType());
        } else if (mType == 2) {
            url = Constants.HTTP_URL_GET_EXPOSUREUSER_RELGROUPUUIDLIST;
            HttpUtils.HttpGetRequest_Asyn(url, params,
                    callBack, new TypeToken<List<SelectMember>>() {
                    }.getType());
        } else if (mType == 3) {
            url = Constants.HTTP_URL_GET_NOTICTARGETRELGROUPUUID;
            HttpUtils.HttpGetRequest_Asyn(url, params,
                    callBack, new TypeToken<List<SubNoticeTargetEntity>>() {
                    }.getType());
        }

    }


    /**
     * 添加成员
     *
     * @param params
     * @param callBack
     * @param mType
     */
    public void addMemberRequest(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEUSER_USERADD;
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLUSER_USERADD;
        } else if (mType == 2) {
            url = Constants.HTTP_URL_POST_EXPOSUREUSER_USERADD;
        } else if (mType == 3) {
            url = Constants.HTTP_URL_GET_NOTICERLDTARGETEADD;
        }
        HttpUtils.HttpPostRequest_Asyn(url, params, callBack,
                null, false);
    }

}
